import request from "@/utils/request";

// 获取文件列表
export function getmanagementListApi(query) {
  return request({
    url: "/system/file/management/list",
    method: "get",
    params: query,
  });
}

// 获取搜索文件列表
export function getSearchFileApi(data) {
  return request({
    url: "/system/file/management/listByName",
    method: "post",
    data
  });
}

// 获取操作日志
export function getOperateListApi(query, data) {
  return request({
    url: "/system/file/management/selectRecordList",
    method: "post",
    params: query,
    data,
  });
}

// 新增文件夹
export function getaddFolderApi(data) {
  return request({
    url: "/system/file/management/addFolder",
    method: "post",
    data,
  });
}

// 上传文件
export function getuploadApi(data) {
  return request({
    url: "/system/file/management/upload",
    method: "post",
    data,
  });
}

// 删除文件夹
export function getdeletedocApi(folderId) {
  return request({
    url: `/system/file/management/deleteFolder/${folderId}`,
    method: "post",
  });
}


// 删除文件
export function getdeleteApi(fileId) {
  return request({
    url: `/system/file/management/deleteFile/${fileId}`,
    method: "post",
  });
}

// 编辑文件夹
export function geteditdocApi(folderId, data) {
  return request({
    url: `/system/file/management/editFolder/${folderId}`,
    method: "post",
    data,
  });
}

// 删除选中文件
export function deleteChooseDocApi( data) {
  return request({
    url: `/system/file/management/deleteFiles`,
    method: "post",
    data,
  });
}

//查询文件夹对应个人/部门权限
export function getauthorityApi(folderId) {
  return request({
    url: `/system/file/management/getFolder`,
    method: "get",
    params: { folderId },
  });
}

//分享文件
export function getshareApi(data) {
  return request({
    url: `/system/folderShare/add`,
    method: "post",
    data,
  });
}

//分享文件
export function getselectFolderShareListApi() {
  return request({
    url: `/system/folderShare/selectFolderShareList`,
    method: "get",
  });
}

//分享文件
export function getremoveShareListApi(data) {
  return request({
    url: `/system/folderShare/remove`,
    method: "post",
    data,
  });
}

//获取当前登录人部门
export function getDepartId() {
  return request({
    url: `/system/file/management/getSecondLevelDepartmentId`,
    method: "get",
  });
}

//获取当前登录人角色
export function getRoleId() {
  return request({
    url: `/system/file/management/getRoles`,
    method: "get",
  });
}

//新增操作记录
export function addOpearteApi(data) {
  return request({
    url: `/system/fileOperationRecord/add`,
    method: "post",
    data,
  });
}
